package net.oschina.app.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import net.oschina.app.R;
import net.oschina.app.ui.EventActivty;
import net.oschina.app.ui.FinduserActivty;
import net.oschina.app.ui.FriendActivty;
import net.oschina.app.ui.ScanActivty;
import net.oschina.app.ui.ShakeActivty;

import static net.oschina.app.R.id.tv_event;
import static net.oschina.app.R.id.tv_finduser;
import static net.oschina.app.R.id.tv_scan;
import static net.oschina.app.R.id.tv_shake;


/**
 * Created by YL on 2017/3/31.
 */

public class ExploreFragment extends Fragment implements View.OnClickListener {

    private View eView;
    private TextView tvFriends;
    private TextView tvFinduser;
    private TextView tvScan;
    private TextView tvShake;
    private TextView tvEvent;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        eView = inflater.inflate(R.layout.explore_content, container, false);
        tvFriends = (TextView) eView.findViewById(R.id.tv_friends);
        tvFinduser = (TextView) eView.findViewById(tv_finduser);
        tvScan = (TextView) eView.findViewById(tv_scan);
        tvShake = (TextView) eView.findViewById(tv_shake);
        tvEvent = (TextView) eView.findViewById(tv_event);
        inievent();

        return eView;

    }

   private void inievent() {
       tvFriends.setOnClickListener(this);
       tvFinduser.setOnClickListener(this);
       tvScan.setOnClickListener(this);
       tvShake.setOnClickListener(this);
       tvEvent.setOnClickListener(this);

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.tv_friends:
            startTo(FriendActivty.class);
            break;
        } switch (v.getId()){
            case tv_finduser:
            startTo(FinduserActivty.class);
            break;
        } switch (v.getId()){
            case tv_event:
            startTo(EventActivty.class);
            break;
        } switch (v.getId()){
            case tv_scan:
            startTo(ScanActivty.class);
            break;
        } switch (v.getId()){
            case tv_shake:
            startTo(ShakeActivty.class);
            break;
        }
    }

    private void startTo(Class clzz) {
        Intent intent = new Intent(getActivity(),clzz);
        startActivity(intent);
    }



}
